package com.mica.erp.contract.service.impl;

import java.util.List;

import com.mica.erp.contract.model.ContractGood;
import com.mica.erp.contract.service.ContractGoodService;
import com.mica.mybatis.GenericService;

public class ContractGoodServiceImpl extends GenericService implements ContractGoodService {

	@Override
	public List<ContractGood> findContractGoods(ContractGood cg) {
		return this.selectList(namespace+".findContractGoods", cg);
	}

	@Override
	public void saveContractGood(ContractGood cg) {
		Long cgId = cg.getCgId();
		if(null!=cgId){
		}else{
			cg.setCgId(this.incre.nextLongValue());
			int cgNum = cg.getCgNum();
			double cgPrice = cg.getCgPrice();
			cg.setCgAmount(cgPrice*cgNum);
			this.insert(namespace+".insertContractGood", cg);
		}
	}

	@Override
	public void delContractGood(Long cgId) {
		this.delete(namespace+".delContractGood", cgId);
	}

}
